//
//  howcanApi2Get.m
//  howcan
//
//  Created by iMac on 12-4-21.
//  Copyright 2012 __MyCompanyName__. All rights reserved.
//

#import "howcanApi2Get.h"


@implementation howcanApi2Get

- (void)getShopListsWithLat:(float)map_lat withLng:(float)map_lng withPage:(int)thePage withDelegate:(id)theDelegate withIndex:(NSString *)theIndex {
//    if (map_lat==0 && map_lng==0) {
//        [super initWithUrl:[NSString stringWithFormat:@"%@?act=item_list&catid=1&page=%d",M_API,thePage]
//                  postData:NULL
//                  delegate: theDelegate
//                 withIndex:theIndex
//       onCompletedCallback:@selector(completedCallback:)];
//        
//     } else {
         [super initWithUrl:[NSString stringWithFormat:@"%@?act=item_list&catid=1&lat=%f&lng=%f&page=%d",M_API,map_lat,map_lng,thePage]
     
						  //	ApiHelper  * apiHlp =[[ ApiHelper  alloc] initWithUrl:[NSString stringWithFormat:@"%@?act=item_list&catid=1&page=%d",M_API,thePage]
						  
												 postData:NULL
												 delegate: theDelegate
												withIndex:theIndex
									  onCompletedCallback:@selector(completedCallback:)];

//     }
}


- (void)getCategorys:(id)theDelegate withIndex:(NSString *)theIndex{
	[super initWithUrl:[NSString stringWithFormat:@"%@category.php",M_CACHE]
												 postData:NULL
												 delegate: theDelegate
												withIndex:theIndex
									  onCompletedCallback:@selector(completedCallback:)];
}

- (void)getAreas:(id)theDelegate withIndex:(NSString *)theIndex{
	[super initWithUrl:[NSString stringWithFormat:@"%@area.php",M_CACHE]
												 postData:NULL
												 delegate: theDelegate
												withIndex:theIndex
									  onCompletedCallback:@selector(completedCallback:)];
}


- (void)postShopAdd:(NSDictionary *)forms withDelegate:(id)theDelegate withIndex:(NSString *)theIndex {
	[super initWithUrl:[NSString stringWithFormat:@"%@?act=member&ac=subject_add",M_API]
												 postData: forms
												 delegate: theDelegate
												withIndex:theIndex
									  onCompletedCallback:@selector(completedCallback:)];
}

- (void)loging:(NSString *)username withPassword:(NSString *)password withDelegate:(id)theDelegate withIndex:(NSString *)theIndex {
	NSDictionary  * loginData=[NSDictionary  dictionaryWithObjectsAndKeys: 
							   username,@"username",
							   password,@"password",
							   @"yes",@"onsubmit",
							   nil];
	
	
	[super initWithUrl:[NSString stringWithFormat:@"%@?act=user&op=ulogin",M_API]
												 postData: loginData
												 delegate: theDelegate
												withIndex:theIndex
									  onCompletedCallback:@selector(completedCallback:)];
	
}

@end
